import React, { useEffect, useState } from 'react';
import { Menu, Icon } from 'antd';
import { ContextMenu } from 'gg-editor';
import styles from './index.less';

const EdgeMenu = props => {
  const { node, eventObj, menuClick } = props;
  return (
    <div >
      <ContextMenu
        type={'edge'}
        ref={props.onRef}
        renderContent={(item, position, hide) => {
          const { x: left, y: top } = position;
          return (
            <div style={{ position: 'absolute', top, left }} className={styles.menu}>
              <Menu mode="vertical" selectable={false} onClick={e => props.menuClick(e, item)}>
                <Menu.Item key={'delete_edge'}>
                  <Icon type="delete" />
                  删除边
                </Menu.Item>
              </Menu>
            </div>
          );
        }}
      />
    </div>
  );
};

export default EdgeMenu;
